package com.atguigu.servlet;

import jakarta.servlet.http.HttpServlet;

public class Servlet02LifeCycle extends HttpServlet {

    // 1. 创建对象：调用无参构造器
    public Servlet02LifeCycle() {
        System.out.println("Servlet02LifeCycle对象创建了");
    }

    // 2. 初始化：调用init方法
    public void init() {
        System.out.println("Servlet02LifeCycle对象初始化");
    }

    // 3. 销毁：调用destroy方法
    public void destroy() {
        System.out.println("Servlet02LifeCycle对象销毁了");
    }

    // 4、处理每一个请求：service方法
    public void service(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res) throws jakarta.servlet.ServletException, java.io.IOException {
        System.out.println("Servlet02LifeCycle对象service方法执行了");
    }

}
